package main

import (
	"log"
	"net/http"
)

func main() {
	//启动服务器
	srv := &http.Server{
		Addr:    ":8080",
		Handler: http.HandlerFunc(handle),
	}

	log.Printf("Serving on https://0.0.0.0:8080")
	log.Fatal(srv.ListenAndServeTLS("server.crt", "server.key"))
}

//处理器函数
func handle(w http.ResponseWriter, r *http.Request) {
	//记录请求协议
	log.Printf("Got connection: %s", r.Proto)
	//向客户发送一条消息
	w.Write([]byte("Hello this is a Http 2 message!"))
}
